package com.ims.DAO;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.ims.hibernate.ProvidersFileImportStatus;
import com.ims.hibernate.Student;
import com.ims.util.HibernateUtil;



public class ProviderFileImportStatusDAO {
	public static void main(String[] args) {
		ProviderFileImportStatusDAO p = new ProviderFileImportStatusDAO();
		
	Long a =	p.save("waseem", "2012/01/22 17:58:20", "2012/01/22 17:59:10", true);
	}
	
	public Long save(String fileName, String startTime, String endTime, Boolean status){
		Session session = HibernateUtil.getSessionFactory().openSession();
		Transaction transaction = null;
		Long p = null;
		
		try {
			transaction = session.beginTransaction();
			ProvidersFileImportStatus providersFileImportStatus = new ProvidersFileImportStatus();
			providersFileImportStatus.setFileName(fileName);
			providersFileImportStatus.setStartTime(startTime);
			providersFileImportStatus.setEndTime(endTime);
			providersFileImportStatus.setStatus(status);
			
			
			session.save(providersFileImportStatus);
			transaction.commit();
		} catch (HibernateException e) {
			transaction.rollback();
			e.printStackTrace();
		} finally {
			session.close();
		}
		return p;
	}
	


}
